<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>定位</title>
    <style>
      .father {
        width: 400px;
        height: 400px;
        border: 1px solid #000;
        /* 父元素 添加相对定位, 子元素就会以她为参考依据 */
        position: relative;
        
      }

      .one {
        width: 100px;
        height: 50px;
        background-color: orange;
        /* 
        开启定位之后, 元素不占位, 后面的内容会自动补上去
        绝对定位开启之后, 默认会以也页面为参考的标准
        */
        position: absolute;
        top: 30px;
        right: 20px;
        z-index: 1;
      }

      .two {
        width: 100px;
        height: 50px;
        background-color: green;
        position: absolute;
        right: 30px;
        z-index: 2;
      }
    </style>
  </head>
  <body>
    <div class="father">
      <div class="one">one</div>
      <div class="two">two</div>
    </div>
  </body>
</html>
